<template>
  <div class="page_vue">
    <div class="page_header">
      <div class="page_header_left">
        <img src="../../../assets/images/home/help.png" style="width:18px" alt="" />
        <span class="page_header_left_title">{{ $t('home.helpCenter') }}</span>
      </div>
      <img src="../../../assets/images/home/right.png" style="width:5px" alt="" />
    </div>
    <div class="page_content">
      <div class="input_box">
        <el-input v-model="searchInput" :placeholder="$t('home.searchPhrase')" suffix-icon="el-icon-search"
          @keyup.enter.native="searchEnterClick"></el-input>
      </div>
      <div class="question_box" v-for="(item, index) in questionList" :key="index" @click="skipClick(item)">
        <svg-icon v-if="item.icon" :icon-class="item.icon" :style="{ color: item.iconColor }"></svg-icon>
        <i v-else class="el-icon-s-order"></i>
        <span class="question_box_title">{{ item.title }}</span>
      </div>
    </div>
    <div style="display: flex;justify-content: center;">
      <el-pagination style="margin-top: 8px;" small @size-change="handleSizeChange"
        @current-change="handleCurrentChange" :current-page.sync="requestParams.page" :page-size="requestParams.size"
        layout=" prev, pager, next" :total="requestParams.total">
      </el-pagination>
    </div>
  </div>
</template>

<script setup lang="ts">
// import crudSysHelpCenter from "@/api/peizhi/sysHelpCenter.js";
const searchInput = ref("")
const questionList = ref([])
const requestParams = ref({
  page: 1,
  size: 10,
  total: 0
})

const apiHelpUserQuery = () => {
  // crudSysHelpCenter
  //       .apiHelpUserQuery({
  //         page: this.requestParams.page - 1,
  //         size: this.requestParams.size,
  //         title: this.searchInput
  //       })
  //       .then((res) => {
  //         this.questionList = res.rows;
  //         this.requestParams.total = res.totalCount;
  //       });
}

const searchEnterClick = () => {
  handleCurrentChange(1);
}
const handleSizeChange = (val: any) => {
  requestParams.value.size = val;
  apiHelpUserQuery();
}
const handleCurrentChange = (val: any) => {
  requestParams.value.page = val;
  apiHelpUserQuery();
}

const skipClick = (val: any) => {
  window.open(val.titleUrl);
}
onMounted(() => {
  apiHelpUserQuery();
});

</script>
<style scoped lang='scss'>
.page_header {
  display: flex;
  justify-content: space-between;
  align-items: center;

  .page_header_left {
    font-size: 0;
    display: flex;
    align-items: center;

    .page_header_left_title {
      font-size: 16px;
      color: #292929;
      margin-left: 5px;
      font-weight: 600;
    }
  }
}

.page_content {
  cursor: pointer;

  .input_box {
    margin: 20px 0;

    :deep(.el-input__wrapper)  {
      border-radius: 16px;
      background: #eef9ff;
      border: 1px solid #adc1d8;
    }

    :deep(.el-input__inner::placeholder)  {
      color: #7191b1;
    }
  }

  .question_box {
    cursor: pointer;
    width: 220px;
    display: flex;
    align-items: center;
    margin: 20px 0;
    font-size: 13px;
    color: #555555;
    text-overflow: ellipsis;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 1; //元素几行显示
    -webkit-box-orient: vertical;

    &:hover {
      color: #3b8df5;
    }
  }
}

:deep(.el-pagination button)  {
  background-color: rgba(0, 0, 0, 0);
}

:deep(.el-pager li)  {
  background-color: rgba(0, 0, 0, 0);
}
</style>